#pragma once
#include <cstring>

#include "DataStructure/Common/Id.h"
#include "DataStructure/Common/Real.h"

SG_DATASTRUCTURE_POST_NAMESPACE_OPEN

struct TETRAStrainData
{
    SG::DataStructure::Common::Id   m_eId      = 0;      /// Element identification number
    SG::DataStructure::Common::Id   m_CID      = 0;      /// Stress Coordinate System
    char                            m_CTYPE[4] = { 0 };  /// Coordinate System Type (BCD)
    SG::DataStructure::Common::I64  m_NODEF    = 0;      /// Number of Active Points
    SG::DataStructure::Common::Id   m_GRID[5]  = { 0 };  /// Number of active grids or corner grid ID
    SG::DataStructure::Common::Real m_X[5]     = { 0 };  /// Normal X
    SG::DataStructure::Common::Real m_Y[5]     = { 0 };  /// Normal Y
    SG::DataStructure::Common::Real m_Z[5]     = { 0 };  /// Normal Z
    SG::DataStructure::Common::Real m_TXY[5]   = { 0 };  /// Shear xy
    SG::DataStructure::Common::Real m_TYZ[5]   = { 0 };  /// Shear yz
    SG::DataStructure::Common::Real m_TZX[5]   = { 0 };  /// Shear zx
    SG::DataStructure::Common::Id   m_domainId = 0;      /// Domain identifier

    void SetCType (SG::DataStructure::Common::I64 m_stress)
    {
        if (m_stress == 0)
        {
            std::memcpy (m_CTYPE, "GRID", 4);
        }
        else
        {
            std::memcpy (m_CTYPE, "GAUS", 4);
        }
    }
};

///< @brief 判断数据是否相等
DECLSPEC bool operator== (const TETRAStrainData& val1, const TETRAStrainData& val2);

///< @brief 排序使用
DECLSPEC bool operator< (const TETRAStrainData& a, const TETRAStrainData& b);

SG_DATASTRUCTURE_POST_NAMESPACE_CLOSE
